﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.Entity.ModelConfiguration;
using System.ComponentModel.DataAnnotations.Schema;

namespace DuToanT2.Models.Mapping
{
    public class HangMucMap : EntityTypeConfiguration<HangMuc>
    {
        public HangMucMap()
        { 
            // key
            HasKey(t => t.ID);

            // properties
            Property(t => t.ID);
            Property(t => t.Name);
            Property(t => t.Description);

            // table
            ToTable("HangMuc");

            // relationship
            HasRequired(t => t.Project)
                .WithMany(c => c.HangMucs)
                .HasForeignKey(t => t.ProjectId)
                .WillCascadeOnDelete(true);
        }
    }
}
